﻿<script type="text/javascript">
        function OnSelectAllRowsLinkClick(){
            grid.SelectRows();
        }
        function OnUnselectAllRowsLinkClick(){
           grid.UnselectRows();
        }
        function OnGridViewInit(){
            UpdateTitlePanel();
        }
        function OnGridViewSelectionChanged(){
            UpdateTitlePanel();
        }
        function OnGridViewEndCallback(){
            UpdateTitlePanel();
        }
        function UpdateTitlePanel(){
            var selectedFilteredRowCount = grid.GetSelectedFilteredRowCount();
            if(selectAllMode.GetValue() != "AllPages"){
                lnkSelectAllRows.SetVisible(grid.cpVisibleRowCount > selectedFilteredRowCount);
                lnkClearSelection.SetVisible(grid.GetSelectedRowCount() > 0);
            }

            var text = "Total rows selected: <b>" + grid.GetSelectedRowCount() + "</b>. ";
            var hiddenSelectedRowCount = grid.GetSelectedRowCount() - grid.GetSelectedFilteredRowCount();
            if(hiddenSelectedRowCount > 0)
                text += "Selected rows hidden by the applied filter: <b>" + hiddenSelectedRowCount + "</b>.";
            text += "<br />";
            info.SetText(text);
        }
    </script>